package com.chenfan.mcn.model.dto;

import com.chenfan.common.extension.validation.groups.Modify;
import lombok.Data;
import org.hibernate.validator.constraints.Length;

import javax.validation.Valid;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.Digits;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.List;

/**
 * 红人月度结算单-财务审批DTO
 * @author fhlj
 */
@Data
public class StarMonthlySettlementFinanceExamineDTO implements Serializable {

    private static final long serialVersionUID = 4593296515202621511L;

    /**
     * 结算单ID
     */
    @NotNull(message = "结算单ID不能为空")
    private Long settlementId;

    /**
     * 打款金额信息
     */
    @Valid
    @NotNull(message = "打款金额信息不能为空")
    private List<FinancePaidInfo> financePaidInfoList;

    /**
     * 流程实例ID
     */
    @NotNull(message = "流程实例ID不能为空")
    private Long approvalId;

    /**
     * 打款金额信息
     */
    @Data
    public static class FinancePaidInfo {
        /**
         * 子结算单ID
         */
        @NotNull(message ="子结算单ID不能为空", groups = {Modify.class})
        private Long subSettlementId;

        /**
         * 财务分成金额备注
         */
        @Length(max = 500, message = "财务分成金额备注最大长度不能超过500")
        private String remark;

        /**
         * 线上结算发票金额（元）
         */
        @NotNull(message = "【线上结算发票金额（元）】必填", groups = {Modify.class})
        @DecimalMin(value = "0")
        @Digits(integer = 12, fraction = 2, message = "【线上结算发票金额】数值必须大于等于0，其中整数位最多{integer}位，小数位最多{fraction}位")
        private BigDecimal onlineInvoiceAmount;


        /**
         * 财务确认可分成金额（元）
         */
        @NotNull(message = "【财务确认可分成金额（元）】必填", groups = {Modify.class})
        @Digits(integer = 12, fraction = 2, message = "【线上结算发票金额】数值必须大于等于0，其中整数位最多{integer}位，小数位最多{fraction}位")
        private BigDecimal financeConfirmedDevidedAmount;

        /**
         * 财务附件
         */
        private String financeAttachment;
    }
}
